#ifndef MESH_GEOMETRY_HH
#define MESH_GEOMETRY_HH

#include <vector>
#include <cgmath/cgmath.hh>
#include "geometry.hh"

/// Mesh geometry
class mesh_geometry : public geometry
{
public:
  /// Construct a mesh geometry from a ply definition.
  ///
  /// \param ply_file a .ply file defining a mesh geometry
  mesh_geometry (const char* ply_file);

  virtual double hit (const cgmath::ray_3d& r) const;
  virtual void hit_surface_point (surface_point&) const;

protected:
  std::vector<cgmath::triangle_3d> triangles;
  mutable cgmath::vector_3d hit_point;
  mutable cgmath::vector_3d hit_normal;
};

#endif
